﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Presentation.ViewModels;

namespace Presentation.Views
{
    /// <summary>
    /// Interaction logic for AddAnecdoteView.xaml
    /// </summary>
    public partial class AddAnecdoteView : UserControl
    {
        public AddAnecdoteView()
        {
            InitializeComponent();
        }

        private void AutoCompleteBox_KeyUp(object sender, KeyEventArgs e)
        {
            //if (e.Key == Key.Enter)
            //{
            //    //AddAnecdotesViewModel addAnecdotesViewModel = (this.DataContext as AddAnecdotesViewModel);
            //    AutoCompleteBox acb = ((AutoCompleteBox)(sender));

            //    if (addAnecdotesViewModel.CanAddNewAnecdote)
            //    {
            //        if (acb.IsDropDownOpen)
            //        {
            //            KeyEventArgs tabKeyDown = new KeyEventArgs(Keyboard.PrimaryDevice, Keyboard.PrimaryDevice.ActiveSource, 0, Key.Tab);
            //            tabKeyDown.RoutedEvent = Keyboard.KeyDownEvent;

            //            InputManager.Current.ProcessInput(tabKeyDown);
            //        }
            //        else
            //        {
            //            addAnecdotesViewModel.AddNewAnecdote();

            //            List<KeyEventArgs> tabPresses = new List<KeyEventArgs>(6);

            //            for (int i = 0; i < 8; i++)
            //            {
            //                KeyEventArgs tabKeyDown = new KeyEventArgs(Keyboard.PrimaryDevice, Keyboard.PrimaryDevice.ActiveSource, 0, Key.Tab);
            //                tabKeyDown.RoutedEvent = Keyboard.KeyDownEvent;

            //                tabPresses.Add(tabKeyDown);
            //            }

            //            foreach (KeyEventArgs keyEventArgs in tabPresses)
            //            {
            //                InputManager.Current.ProcessInput(keyEventArgs);
            //            }
            //        }
            //    }

            //}
        }
    }
}
